import { test, describe } from "node:test"; import assert from "node:assert"; import { reverse } from "../src/reverse.js"; describe("reverse function", () => { test("should reverse a normal string", () => { assert.strictEqual(reverse("world"), "dlrow"); }); test("should return empty string when input is empty", () => { assert.strictEqual(reverse(""), ""); }); test("should throw TypeError for non-string input", () => { assert.throws(() => reverse(null), { name: "TypeError", message: "Input must be a string", }); }); });